class Player:
    """
        玩家类
    """

    def __init__(self, atk, hp):
        self.atk = atk
        self.hp = hp

    def attack(self, enemy):
        print('打击你')
        # 调用敌人受伤方法
        enemy.damage(self.atk)

    def damage(self, value):
        self.hp -= value
        print('玩家受伤了，碎屏了')
        if self.hp <= 0:
            self.__death()

    def __death(self):
        print('玩家死亡，游戏结束')


class Enemy:
    def __init__(self, hp, atk):
        self.hp = hp
        self.atk = atk

    def damage(self, value):
        self.hp -= value
        if self.hp <= 0:
            self.__death()
        else:
            print('受伤啦')

    def attack(self, player):
        player.damage(self.atk)

    def __death(self):
        print("死啦，播放动画")


p01 = Player(100, 50)
# 玩家打敌人
e01 = Enemy(60, 10)
p01.attack(e01)
